package org.elsfs.domain.manager;

import org.elsfs.domain.entity.SysUser;

/** 用户管理接口 */
public interface SysUserManager {
  /** bean name. */
  String BEAN_NAME = "sysUserManager";

  /**
   * 根据用户名查询 {@link SysUser}
   *
   * @param username 用户名
   * @return SysUser
   */
  SysUser getUserByUsername(String username);

  /**
   * 根据手机号查询{@link SysUser}.
   *
   * @param phone 手机号
   * @return SysUser.
   */
  SysUser getUserByPhone(String phone);

  /**
   * 根据userId查询{@link SysUser}.
   *
   * @param userId userId.
   * @return SysUser.
   */
  SysUser getUserByUserId(String userId);

  /**
   * 根据{code email}查询{@link SysUser}.
   *
   * @param email email.
   * @return SysUser.
   */
  SysUser getUserByEmail(String email);

  /**
   * 创建{@link SysUser }.
   *
   * @param user user {@link SysUser} .
   * @return {@code SysUser}.
   */
  SysUser createUser(SysUser user);

  /**
   * 更新{@link SysUser }.
   *
   * @param user user {@link SysUser} .
   * @return this {@code SysUser}.
   */
  SysUser updateUser(SysUser user);

  /**
   * 删除{@link SysUser } 根据{@code userId}.
   *
   * @param user user
   * @return 成功删除为true，反之false
   */
  boolean deleteUser(SysUser user);

  /**
   * 根据用户名删除 {@link SysUser}
   *
   * @param username 用户名
   * @return 成功删除为true，反之false
   */
  boolean deleteUserByUsername(String username);

  /**
   * 根据{@code userId}删除{@link SysUser user}
   *
   * @param userId userId
   * @return 成功删除为true，反之false
   */
  boolean deleteUserByUserId(String userId);
}
